home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / ghostscr / gsview07.zip / gsview.h < prev    next >
C/C++ Source or Header  |  1993-05-10  |  14KB  |  465 lines

  1. /*
  2.  * gsview.h -- Include file for GSVIEW.EXE 
  3.  * Copyright (C) 1993  Russell Lang
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or
  8.  * (at your option) any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  *
  19.  *   Author: Russell Lang
  20.  * Internet: rjl@monu1.cc.monash.edu.au
  21.  */
  22.  
  23. #define GSVIEW_VERSION "0.7 beta 1993-05-10"
  24.  
  25. #define ID_ANSWER    51
  26. #define ID_PROMPT    52
  27. #define ID_HELP        53
  28.  
  29. #define IDM_OPEN    101
  30. #define IDM_NEXT    102
  31. #define IDM_NEXTSKIP    103
  32. #define IDM_REDISPLAY   104
  33. #define IDM_PREV    105
  34. #define IDM_PREVSKIP    106
  35. #define IDM_GOTO    107
  36. #define IDM_INFO    108
  37. #define IDM_SELECT    109
  38. #define IDM_PRINT    110
  39. #define IDM_PRINTTOFILE 111
  40. #define IDM_SPOOL    112
  41. #define IDM_EXTRACT    113
  42. #define IDM_PSTOEPS    114
  43. #define IDM_EXIT    115
  44. #define IDM_DROP    116
  45.  
  46. #define IDM_COPYCLIP    151
  47. #define IDM_PASTETO    152
  48. #define IDM_CONVERT    153
  49. #define IDM_MAKEEPSI    154
  50. #define IDM_MAKEEPST    155
  51. #define IDM_MAKEEPSW    156
  52. #define IDM_EXTRACTPS    157
  53. #define IDM_EXTRACTPRE    158
  54.  
  55. #define IDM_GSCOMMAND      175
  56. #define IDM_SOUNDS      176
  57. #define IDM_SETTINGS      177
  58. #define IDM_SAVESETTINGS  178
  59. #define IDM_SAVEDIR      179
  60. #define IDM_BUTTONSHOW      180
  61. #define IDM_QUICK      181
  62. #define IDM_AUTOREDISPLAY 182
  63. #define IDM_EPSFCLIP      183
  64. #define IDM_EPSFWARN      184
  65.  
  66. #define IDM_PORTRAIT    201
  67. #define IDM_LANDSCAPE   202
  68. #define IDM_UPSIDEDOWN  203
  69. #define IDM_SEASCAPE    204
  70. #define IDM_SWAPLANDSCAPE 205
  71.  
  72. #define IDM_RESOLUTION  251
  73.  
  74. #define IDM_LETTER    301
  75. #define IDM_LETTERSMALL    302
  76. #define IDM_TABLOID    303
  77. #define IDM_LEDGER    304
  78. #define IDM_LEGAL    305
  79. #define IDM_STATEMENT    306
  80. #define IDM_EXECUTIVE    307
  81. #define IDM_A3        308
  82. #define IDM_A4        309
  83. #define IDM_A4SMALL    310
  84. #define IDM_A5        311
  85. #define IDM_B4        312
  86. #define IDM_B5        313
  87. #define IDM_FOLIO    314
  88. #define IDM_QUARTO    315
  89. #define IDM_10X14    316
  90. #define IDM_USERSIZE    317
  91. #define IDM_MEDIALAST    318
  92.  
  93. #define IDM_HELPCONTENT 351
  94. #define IDM_HELPSEARCH    352
  95. #define IDM_ABOUT    353
  96.  
  97. #define INFO_FILE    401
  98. #define INFO_TYPE    402
  99. #define INFO_TITLE    403
  100. #define INFO_DATE    404
  101. #define INFO_BBOX    405
  102. #define INFO_ORIENT    406
  103. #define INFO_ORDER    407
  104. #define INFO_DEFMEDIA    408
  105. #define INFO_NUMPAGES    409
  106. #define INFO_PAGE    410
  107. #define INFO_BITMAP    411
  108. #define INFO_ICON    412
  109.  
  110. #define ABOUT_ICON    451
  111. #define ABOUT_VERSION    452
  112.  
  113. #define SOUND_EVENT    501
  114. #define SOUND_FILE    502
  115. #define SOUND_PATH    503
  116. #define SOUND_TEST    504
  117.  
  118. #define SPOOL_PORT    525
  119.  
  120. #define CANCEL_PCDONE    541
  121.  
  122. #define PAGE_LIST    551
  123. #define PAGE_ALL    552
  124. #define PAGE_ODD    553
  125. #define PAGE_EVEN    554
  126.  
  127. #define DEVICE_NAME    561
  128. #define DEVICE_RES    562
  129. #define DEVICE_RESTEXT    563
  130. #define DEVICE_PROP    564
  131.  
  132. #define PROP_NAME    571
  133. #define PROP_VALUE    572
  134.  
  135. #define EPS_INTERCHANGE    581
  136. #define EPS_WINDOWS    582
  137. #define EPS_TIFF    583
  138.  
  139. #define BB_PROMPT    591
  140. #define BB_CLICK    592
  141.  
  142. #define FILTER_PS    1
  143. #define FILTER_EPS    2
  144. #define FILTER_EPI    3
  145. #define FILTER_ALL    4
  146. #define FILTER_BMP    5
  147. #define FILTER_TIFF    6
  148. #define FILTER_WMF    7
  149. #define IDS_FILTER    601
  150. #define IDS_TITLE    602
  151. #define IDS_HELPFILE    603
  152. #define IDS_WRONGGS    604
  153. #define IDS_BUSY    605
  154.  
  155. #define IDS_FILE    610
  156. #define IDS_NOFILE    611
  157. #define IDS_PAGE    612
  158. #define IDS_NOPAGE    613
  159. #define IDS_LANDSCAPE    614
  160. #define IDS_PORTRAIT    615
  161. #define IDS_ASCEND    616
  162. #define IDS_DESCEND    617
  163. #define IDS_SPECIAL    618
  164. #define IDS_EPSF    619
  165. #define IDS_EPSI    620
  166. #define IDS_EPST    621
  167. #define IDS_EPSW    622
  168. #define IDS_DSC        623
  169. #define IDS_NOTDSC    624
  170. #define IDS_PAGEINFO    625
  171.  
  172. #define IDS_OUTPUTFILE    630
  173. #define IDS_PRINTINGALL    631
  174. #define IDS_PRINTFILE    632
  175. #define IDS_NOSPOOL    633
  176. #define IDS_SELECTPAGE    634
  177. #define IDS_SELECTPAGES    635
  178. #define IDS_TIMEOUT    636
  179. #define IDS_NOTIMER    637
  180. #define IDS_NOTOPEN    638
  181. #define IDS_CANNOTRUN    639
  182. #define IDS_TOOLONG    640
  183. #define IDS_WAIT    641
  184. #define IDS_NOMORE    642
  185. #define IDS_GSCOMMAND    643
  186. #define IDS_RES        644
  187. #define    IDS_USERWIDTH    645
  188. #define    IDS_USERHEIGHT    646
  189. #define IDS_BADEPS    647
  190. #define IDS_NOPREVIEW    648
  191. #define IDS_CFILEOPEN    649
  192. #define IDS_CFILEERR    650
  193. #define IDS_PIPEERR    651
  194. #define IDS_CANCELDONE    652
  195.  
  196. #define IDS_SOUNDNAME    670
  197. #define IDS_SNDPAGE    671
  198. #define IDS_SNDNOPAGE    672
  199. #define IDS_SNDNONUMBER 673
  200. #define IDS_SNDNOTOPEN    674
  201. #define IDS_SNDERROR    675
  202. #define IDS_SNDTIMEOUT    676
  203. #define IDS_SNDSTART    677
  204. #define IDS_SNDEXIT    678
  205. #define IDS_SOUNDNOMM    679
  206. #define IDS_NONE    680
  207. #define IDS_SPKR    681
  208.  
  209. /* help topics */
  210. #define IDS_TOPICROOT    701
  211. #define IDS_TOPICOPEN    702
  212. #define IDS_TOPICPRINT    703
  213. #define IDS_TOPICEDIT    704
  214. #define IDS_TOPICGSCMD    705
  215. #define IDS_TOPICSOUND    706
  216. #define IDS_TOPICMEDIA  707
  217. #define IDS_TOPICPSTOEPS 708
  218.  
  219. /* ps_to_eps */
  220. #define IDS_BBPROMPT    750
  221. #define IDS_BBPROMPT1    751
  222. #define IDS_BBPROMPT2    752
  223. #define IDS_BBPROMPT3    753
  224. #define IDS_EPSONEPAGE    754
  225. #define IDS_EPSQPAGES    755
  226. #define IDS_EPSNOBBOX    756
  227.  
  228. /* now the stuff that the resource compiler shouldn't see */
  229. #ifndef RC_INVOKED
  230. /* messages used between gsview and gswin */
  231. #define WM_GSVIEW WM_USER+0
  232. /* from gswin to gsview */
  233. #define HWND_TEXT    0
  234. #define HWND_IMGCHILD    1
  235. #define GSWIN_CLOSE    2
  236. #define SYNC_OUTPUT    3
  237. #define OUTPUT_PAGE    4
  238. #define SCROLL_POSITION 5
  239. #define PIPE_REQUEST    6
  240. /* from gsview to gswin image window */
  241. #define NEXT_PAGE    10
  242. #define COPY_CLIPBOARD    11
  243. /* from gsview to gswin text window */
  244. #define PIPE_DATA    12
  245.  
  246. #define MAXSTR 80
  247. #define PROFILE_SIZE 2048
  248. #define DEFAULT_GSCOMMAND "gswin"
  249. #define DEFAULT_RESOLUTION 96.0
  250. #define INIFILE "gsview.ini"
  251. #define INISECTION "Options"
  252. #define DEVSECTION "Devices"
  253.  
  254. extern char szAppName[MAXSTR];        /* application name - for title bar */
  255. extern const char szClassName[];    /* window class */
  256. extern const char szScratch[];        /* temporary filename prefix */
  257.  
  258. /* initialised in init.c */
  259. extern BOOL is_win31;            /* To allow selective use of win 3.1 features */
  260. extern char szHelpName[MAXSTR];        /* buffer for building help filename */
  261. extern char szHelpTopic[48];        /* topic for OFN_SHOWHELP */
  262. extern UINT help_message;        /* message sent by OFN_SHOWHELP */
  263. extern HMENU hmenu;            /* main menu */
  264. extern HACCEL haccel;            /* menu accelerators */
  265. extern HCURSOR hcWait;
  266. extern POINT img_offset;        /* offset to gswin child window */
  267. extern POINT info_file;            /* position of file information */
  268. extern POINT info_page;            /* position of page information */
  269. extern RECT  info_rect;            /* position and size of brief info area */
  270. extern RECT  info_coord;        /* position and size of coordinate information */
  271. extern RECT  button_rect;        /* position and size of button area */
  272.  
  273. extern HINSTANCE phInstance;        /* instance of gsview */
  274. extern HINSTANCE gswin_hinst;        /* instance of gswin */
  275. extern HWND hwndimg;            /* gsview main window */
  276. extern HWND hDlgModeless;        /* any modeless dialog box */
  277. extern HWND hwndtext;            /* gswin text window */
  278. extern HWND hwndimgchild;        /* gswin image child window */
  279. extern int bitmap_scrollx;        /* offset from bitmap to origin of child window */
  280. extern int bitmap_scrolly;
  281. extern int bitmap_width;        /* size of gswin bitmap in pixels */
  282. extern int bitmap_height;
  283.  
  284. extern struct document *doc;        /* DSC structure.  NULL if not DSC */
  285. extern int pagenum;            /* current page number */
  286. extern char dfname[MAXSTR];        /* name of selected document file */
  287. extern FILE *dfile;            /* selected file */
  288. extern char cfname[MAXSTR];        /* temporary command filename */
  289. extern FILE *cfile;            /* command file */
  290. extern char efname[MAXSTR];        /* name of temp file extracted from DOS EPS file */
  291. extern char pfname[MAXSTR];        /* name of temp file for printing options */
  292. extern BOOL is_ctrld;            /* TRUE if DSC except for ctrl+D at start of file */
  293. extern int preview;            /* preview type IDS_EPSF, IDS_EPSI, etc. */
  294. extern BOOL page_ready;            /* true when gswin has sent an OUTPUT_PAGE and is waiting for NEXT_PAGE */
  295. extern BOOL at_prompt;            /* true if at prompt */
  296. extern BOOL saved;            /* true if interpreter state currently saved in /gssave */
  297. extern BOOL bPipeDone;            /* true if PIPE_REQUEST from gswin */
  298. extern int bitmap_scrollx;        /* offset from bitmap to origin of child window */
  299. extern int bitmap_scrolly;
  300. extern OPENFILENAME ofn;
  301. extern char szOFilename[MAXSTR];    /* filename for OFN */
  302. #define DEFAULT_TIMEOUT 120        /* 120 seconds */
  303. #define CLOSE_TIMEOUT    20
  304. extern BOOL bTimeout;            /* true if timeout occured */
  305. extern WNDPROC lpfnButtonWndProc;    /* default button WndProc */
  306. extern HINSTANCE hlib_mmsystem;        /* DLL containing sndPlaySound function */
  307. typedef BOOL (WINAPI *FPSPS)(LPCSTR, UINT);
  308. extern FPSPS lpfnSndPlaySound;        /* pointer to sndPlaySound function if loaded */
  309. extern BOOL epsf_clipped;        /* clipping this page? */
  310. #define BEEP "beep"            /* profile entry for a speaker beep */
  311. extern BOOL debug;            /* /D command line option used */
  312. /* imitation pipe */
  313. #define PIPE_DATASIZE 16384U    /* maximum block size */
  314. extern BOOL bPipeDone;        /* has PIPE_REQUEST been received and not met? */
  315. extern HFILE hfPipe;        /* file handle for pipe */
  316. struct page_list_s {
  317.     int current;    /* index of current selection */
  318.     BOOL multiple;    /* true if multiple selection allowed */
  319.     BOOL *select;    /* array of selection flags */
  320. };
  321. extern struct page_list_s page_list;
  322.  
  323. /* these can be saved in the INI file */
  324. extern char szGSwin[128];
  325. extern POINT img_origin;
  326. extern POINT img_size;
  327. extern BOOL quick;
  328. extern BOOL settings;
  329. extern BOOL button_show;
  330. extern int media;
  331. extern int user_width, user_height;
  332. extern BOOL epsf_clip;
  333. extern BOOL epsf_warn;
  334. extern BOOL redisplay;
  335. extern int orientation;
  336. extern BOOL swap_landscape;
  337. extern float xdpi, ydpi;
  338. extern UINT timeout;
  339. extern BOOL save_dir;
  340. extern char device_name[32];
  341. extern char device_resolution[32];
  342. #define SOUND_PAGE 0
  343. #define SOUND_NOPAGE 1
  344. #define SOUND_NONUMBER 2
  345. #define SOUND_NOTOPEN 3
  346. #define SOUND_ERROR 4
  347. #define SOUND_TIMEOUT 5
  348. #define SOUND_START 6
  349. #define SOUND_EXIT 7
  350. #define NUMSOUND 8
  351. struct sound_s {
  352.     char *entry;        /* profile entry */
  353.     int title;        /* Resource string */
  354.     char file[MAXSTR];    /* empty, "beep", or .WAV sound to play */
  355. };
  356. extern struct sound_s sound[NUMSOUND];
  357.  
  358. /* in gsview.c */
  359. BOOL get_cursorpos(int *x, int *y);
  360. void info_wait(BOOL);
  361. void play_sound(int);
  362. BOOL set_timer(UINT);
  363. void clear_timer(void);
  364. void gsview_orientation(int);
  365. void gsview_media(int);
  366. void gserror(UINT, char *, UINT, int);
  367. void pserror(char *);
  368. LRESULT CALLBACK _export MenuButtonProc(HWND, UINT, WPARAM, LPARAM);
  369. LRESULT CALLBACK _export WndImgProc(HWND, UINT, WPARAM, LPARAM);
  370.  
  371. /* in init.c */
  372. void gsview_init0(LPSTR);
  373. void gsview_init1(LPSTR);
  374. void gsview_create(void);
  375. void show_buttons(void);
  376. void read_profile(void);
  377. void write_profile(void);
  378.  
  379. /* in display.c */
  380. int get_papersizes_index(void);
  381. void gswin_size(void);
  382. void gswin_resize(void);
  383. int gswin_open(void);
  384. int gswin_close(void);
  385. void next_page(void);
  386. void do_message(void);
  387. void gsview_endfile(void);
  388. void gsview_openfile(char *);
  389. void gsview_select(void);
  390. void gsview_selectfile(char *);
  391. void gsview_display(void);
  392. void gsview_displayfile(char *);
  393. void fix_orientation(FILE *f);
  394. BOOL open_cfile(void);
  395. void close_cfile(void);
  396. FILE * gp_open_scratch_file(const char *prefix, char *fname, const char *mode);
  397. BOOL dsc_scan(char *fname);
  398. void dsc_getpages(FILE *f, int first, int last);
  399. void dsc_header(FILE *f);
  400. void dsc_dopage(void);
  401. int map_page(int page);
  402. BOOL pipe_file(char *fname);
  403. int pipe_blk(HFILE hf);
  404. void pipe_close(void);
  405. void pipe_clean(void);
  406.  
  407. /* in dialog.c */
  408. #define OPEN FALSE
  409. #define SAVE TRUE
  410. BOOL getfilename(LPSTR, BOOL, UINT, UINT, UINT);
  411. BOOL get_string(char *, char *);
  412. BOOL CALLBACK _export InputDlgProc(HWND, UINT, WPARAM, LPARAM);
  413. BOOL CALLBACK _export AboutDlgProc(HWND, UINT, WPARAM, LPARAM);
  414. BOOL CALLBACK _export SoundDlgProc(HWND, UINT, WPARAM, LPARAM);
  415. BOOL CALLBACK _export InfoDlgProc(HWND, UINT, WPARAM, LPARAM);
  416. BOOL get_page(int *, BOOL);
  417. BOOL CALLBACK _export PageDlgProc(HWND, UINT, WPARAM, LPARAM);
  418. BOOL gsview_usersize(void);
  419.  
  420. /* in print.c */
  421. BOOL CALLBACK _export DeviceDlgProc(HWND, UINT, WPARAM, LPARAM);
  422. BOOL CALLBACK _export CancelDlgProc(HWND, UINT, WPARAM, LPARAM);
  423. BOOL CALLBACK _export SpoolDlgProc(HWND, UINT, WPARAM, LPARAM);
  424. void gsview_spool(void);
  425. int gp_printfile(char *filename);
  426. void pscopydoc(FILE *fp);
  427. char *get_devices(void);
  428. void gsview_print(BOOL);
  429. void gsview_extract(void);
  430.  
  431. /* clip.c */
  432. LONG dib_bytewidth(LPBITMAPINFOHEADER);
  433. UINT dib_pal_colors(LPBITMAPINFOHEADER);
  434. void clip_to_file(void);
  435. void clip_convert(void);
  436. void clip_add_palette(void);
  437. void clip_add_ddb(void);
  438. void clip_add_dib(void);
  439. void extract_eps(void);
  440. void extract_doseps(WORD);
  441. void make_eps_metafile(void);
  442. void make_eps_tiff(void);
  443. void make_eps_interchange(void);
  444. void epsf_warnprolog(FILE *f);
  445. void ps_to_eps(void);
  446.  
  447. #ifdef WIN32
  448. /* Windows NT has never been tried, but there macros fix up the */
  449.  * known differences from Windows 3.1 */
  450. /* imitation pipes will need to be rewritten to use real pipes */
  451. #define MoveTo(hdc,x,y) MoveToEx((hdc),(x),(y),(LPPOINT)NULL)
  452. #define SetClassCursor(hwnd, hcursor) SetClassLong((hwnd), GCL_HCURSOR, (LONG)(hcursor))
  453. #define GetClassCursor(hwnd) ((HCURSOR)GetClassLong((hwnd), GCL_HCURSOR))
  454. #define GetNotification(wParam,lParam) (HIWORD(wParam))
  455. #define SendDlgNotification(hwnd, id, notice) \
  456.     SendMessage((hwnd), WM_COMMAND, MAKELONG((id),(notice)), GetDlgItem((hwnd),(id)))
  457. #else
  458. #define SetClassCursor(hwnd, hcursor) SetClassWord(hwnd, GCW_HCURSOR, (WORD)(hcursor))
  459. #define GetClassCursor(hwnd) ((HCURSOR)GetClassWord(hwnd, GCW_HCURSOR))
  460. #define GetNotification(wParam,lParam) (HIWORD(lParam))
  461. #define SendDlgNotification(hwnd, id, notice) \
  462.     SendMessage((hwnd), WM_COMMAND, id, MAKELPARAM(GetDlgItem((hwnd),(id)),(notice)))
  463. #endif
  464. #endif /* !RC_INVOKED */
  465.